import React, { PropTypes, Component } from 'react';
import styles from './App.css';
import withContext from '../../decorators/withContext';
import withStyles from '../../decorators/withStyles';
import Header from '../Header';
import Footer from '../Footer';
import TreeLikeUI from '../TreeLikeUI';

@withContext
@withStyles(styles)
class App extends Component {

  static propTypes = {
    children: PropTypes.element.isRequired,
    error: PropTypes.object,
  };

  render() {
    return !this.props.error ? (
      <div className="container">
        <aside className="tree-ui-container">
          <TreeLikeUI data={'/api/resources/tree?resourcesType=menu'}/>
        </aside>
        <Header />
        <div className="main">
          {this.props.children}
        </div>
        <Footer />
      </div>
    ) : this.props.children;
  }
}

export default App;
